//
//  AppDelegate.m
//  Exercise
//
//  Created by zhouxiaobo on 15/11/6.
//  Copyright © 2015年 mapath. All rights reserved.
//

#import "AppDelegate.h"
#import "ViewController.h"
#import "HomePage.h"
#import "ButtonDemo.h"
#import "ImageDemo.h"
#import "ActivityViewDemo.h"
#import "SliderDemo.h"
#import "SegmentDemo.h"
#import "PageControlDemo.h"
#import "TextFieldDemo.h"
#import "NavigationDemo.h"
#import "NavgationBarDemo.h"
#import "UITabBarDemo.h"

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    [application setStatusBarStyle:UIStatusBarStyleLightContent];
    
    self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
    self.window.rootViewController = [[ViewController alloc]init];
    
    UIViewController *homePageVC = [[HomePage alloc]init];
    UITabBarItem *homeBar = [[UITabBarItem alloc]initWithTitle:@"球球" image:[UIImage imageNamed:@"qiuqiu_"] tag:1];
    homePageVC.tabBarItem = homeBar;
    
    UIViewController *buttonDemoVC = [[ButtonDemo alloc]init];
    UITabBarItem *linkmanBar = [[UITabBarItem alloc]initWithTitle:@"通讯录" image:[UIImage imageNamed:@"linkman_"] tag:2];
    buttonDemoVC.tabBarItem = linkmanBar;
    
    UIViewController *imageDemoVC = [[ImageDemo alloc]init];
    UITabBarItem *discoverBar = [[UITabBarItem alloc]initWithTitle:@"发现" image:[UIImage imageNamed:@"discovery_"] tag:3];
    imageDemoVC.tabBarItem = discoverBar;
    
    UIViewController * activityDemo = [[ActivityViewDemo alloc]init];
    UITabBarItem *meBar = [[UITabBarItem alloc]initWithTitle:@"我" image:[UIImage imageNamed:@"me_"] tag:4];
    //activityDemo.tabBarItem = meBar;

    
    //self.window.rootViewController = buttonDemoVC;
    //self.window.rootViewController = homePageVC;
    //self.window.rootViewController = imageDemoVC;
    //self.window.rootViewController = activityDemo;
    //self.window.rootViewController = [[SegmentDemo alloc]init];
    //self.window.rootViewController = [[SliderDemo alloc]init];
    //self.window.rootViewController = [[PageControlDemo alloc]init];
    //self.window.rootViewController = [[TextFieldDemo alloc]init];
    
    //UINavigationController *navigate = [[UINavigationController alloc]initWithRootViewController:[[NavigationDemo alloc]init]];
    UINavigationController *navigate = [[UINavigationController alloc]initWithRootViewController:[[NavgationBarDemo alloc]init]];
    //self.window.rootViewController = navigate;
    navigate.tabBarItem = meBar;

    
    NSArray *tabArr = @[homePageVC,buttonDemoVC,imageDemoVC,navigate];
    UITabBarController *tabController = [[UITabBarController alloc]init];
    
    //tabController.viewControllers = tabArr; //这个也可以
    [tabController setViewControllers:tabArr animated:YES];
    tabController.tabBar.tintColor = [UIColor colorWithRed:0.18 green:0.71 blue:0.22 alpha:1];
    self.window.rootViewController = tabController;
    
    [self.window makeKeyAndVisible];
    
    return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application {

}

- (void)applicationDidEnterBackground:(UIApplication *)application {
    
}

- (void)applicationWillEnterForeground:(UIApplication *)application {

}

- (void)applicationDidBecomeActive:(UIApplication *)application {

}

- (void)applicationWillTerminate:(UIApplication *)application {

}

@end
